package com.bac.rentmap.web.controller.ad.user.view;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.bac.rentmap.ad.flat.user.view.ViewStatisticsManager;

public class DeleteOldViewStatisticsController extends AbstractController {
	private ViewStatisticsManager viewStatisticsManager;

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
	        HttpServletResponse response) throws Exception {
		int res = viewStatisticsManager.deleteOldStatistics();
		response.getWriter().print(
		        "Deleted " + res + " ViewStatistics entries");
		return null;
	}

	@Required
	public void setViewStatisticsManager(
	        ViewStatisticsManager viewStatisticsManager) {
		this.viewStatisticsManager = viewStatisticsManager;
	}
}
